//
//  Client.hpp
//  myhttpserver
//
//  Created by tgy on 2018/3/16.
//  Copyright © 2018年 tgy. All rights reserved.
//

#ifndef Client_hpp
#define Client_hpp

#include <stdio.h>
#include <queue>
#include <sys/socket.h>
#include <sys/types.h>
#include <arpa/inet.h>
#include <string>
class SendMessageItem {
    
private:
    char *conten;
    int len;
    int sendCurrent;
    
public:
    SendMessageItem();
    SendMessageItem(const char *conten,size_t len);
    ~SendMessageItem();
    char * getConten();
    int getLen();
    void setSendCurrent(int sendCurrent);
    int getSendCurrent();
};

class Client {
private:
    //客户端的fd
    int fd;
    struct sockaddr_in s_in;
    std::queue<SendMessageItem *> sendMessage;
    int port;
    //客户端ip地址
    std::string clientIP;

public:
    Client(int fd, struct sockaddr_in s_in);
    ~Client();
    
    std::string getClientIP();
    int getClientPort();
    void pushSendItem(SendMessageItem *smi);
    SendMessageItem *fontSendItem();
    SendMessageItem * popSendItem();
};

#endif /* Client_hpp */
